const arr = [
    {
        "path": "/Map",
        "name": "Map",
        "meta": {
            "auth": true,
            "sort": 1,
            "title": "GIS控制台",
            "roles": [
                3,
                4,
                5
            ],
            "icon": ""
        },
        "label": "GIS控制台"
    },
    {
        "path": "/TaskPlann",
        "name": "TaskPlann",
        "meta": {
            "auth": true,
            "sort": 2,
            "title": "计划任务管理",
            "roles": [
                3,
                4,
                5
            ],
            "icon": "el-icon-date"
        },
        "children": [
            {
                "path": "TaskPlanningList",
                "name": "TaskPlanningList",
                "parent": "TaskPlann",
                "meta": {
                    "sort": "2-1",
                    "title": "计划任务管理",
                    "roles": [
                        3,
                        4
                    ],
                    "icon": "el-icon-date"
                },
                "label": "计划任务管理"
            },
            {
                "path": "MyTask",
                "name": "MyTask",
                "parent": "TaskPlann",
                "meta": {
                    "sort": "2-3",
                    "title": "我的任务",
                    "roles": [
                        3,
                        4,
                        5
                    ],
                    "icon": "el-icon-s-claim"
                },
                "children": [
                    {
                        "path": "MyTaskList",
                        "name": "MyTaskList",
                        "parent": "MyTask",
                        "meta": {
                            "sort": "2-3-1",
                            "title": "任务列表",
                            "roles": [
                                3,
                                4,
                                5
                            ],
                            "icon": ""
                        },
                        "label": "任务列表"
                    },
                    {
                        "path": "MyData",
                        "name": "MyData",
                        "parent": "MyTask",
                        "meta": {
                            "sort": "2-3-2",
                            "title": "我的数据",
                            "roles": [
                                3,
                                4,
                                5
                            ],
                            "icon": ""
                        },
                        "label": "我的数据"
                    },
                    {
                        "path": "NotApproved",
                        "name": "NotApproved",
                        "parent": "MyTask",
                        "meta": {
                            "sort": "2-3-3",
                            "title": "审核不通过待修改",
                            "roles": [
                                3,
                                4,
                                5
                            ],
                            "icon": ""
                        },
                        "label": "审核不通过待修改"
                    }
                ],
                "label": "我的任务"
            },
            {
                "path": "AllData",
                "name": "AllData",
                "parent": "TaskPlann",
                "meta": {
                    "sort": "2-4",
                    "title": "数据审核",
                    "roles": [
                        3,
                        4
                    ],
                    "icon": "el-icon-document"
                },
                "children": [
                    {
                        "path": "AllStatistics",
                        "name": "AllStatistics",
                        "parent": "AllData",
                        "meta": {
                            "sort": "2-4-1",
                            "title": "所有数据",
                            "roles": [
                                3,
                                4
                            ],
                            "icon": "el-icon-document"
                        },
                        "label": "所有数据"
                    },
                    {
                        "path": "AuditableData",
                        "name": "AuditableData",
                        "parent": "AllData",
                        "meta": {
                            "sort": "2-4-2",
                            "title": "待审核数据",
                            "roles": [
                                3,
                                4
                            ],
                            "icon": ""
                        },
                        "label": "待审核数据"
                    },
                    {
                        "path": "NoLongerAudit",
                        "name": "NoLongerAudit",
                        "parent": "AllData",
                        "meta": {
                            "sort": "2-4-3",
                            "title": "不通过再审核",
                            "roles": [
                                3,
                                4
                            ],
                            "icon": ""
                        },
                        "label": "不通过再审核"
                    }
                ],
                "label": "数据审核"
            }
        ],
        "label": "计划任务管理"
    },
    {
        "path": "/DataResource",
        "name": "DataResource",
        "meta": {
            "auth": true,
            "sort": 3,
            "title": "数据资源",
            "name": "数据资源",
            "roles": [
                3,
                4,
                5
            ],
            "icon": "el-icon-office-building"
        },
        "children": [
            {
                "path": "ProductionBase",
                "name": "ProductionBase",
                "parent": "DataResource",
                "meta": {
                    "sort": "3-1",
                    "title": "生产主体库",
                    "roles": [
                        3,
                        4,
                        5
                    ],
                    "icon": "el-icon-office-building"
                },
                "label": "生产主体库"
            },
            {
                "path": "ProductionInformationBase",
                "name": "ProductionInformationBase",
                "parent": "DataResource",
                "sys": "SS2",
                "meta": {
                    "sort": "3-2",
                    "title": "鱼塘生产信息库",
                    "name": "鱼塘生产信息库",
                    "roles": [
                        3,
                        4,
                        5
                    ],
                    "icon": "el-icon-data-board"
                },
                "label": "鱼塘生产信息库"
            }
        ],
        "label": "数据资源"
    },
    {
        "path": "/NamedManagement",
        "name": "NamedManagement",
        "meta": {
            "auth": true,
            "sort": 7,
            "title": "命名管理",
            "roles": [
                3
            ],
            "icon": "el-icon-edit-outline"
        },
        "children": [
            {
                "path": "Rule",
                "name": "Rule",
                "parent": "NamedManagement",
                "meta": {
                    "sort": 7,
                    "title": "命名管理",
                    "roles": [
                        3
                    ],
                    "icon": ""
                },
                "label": "命名管理"
            }
        ],
        "label": "命名管理"
    },
    {
        "path": "TaskPlanningList",
        "name": "TaskPlanningList",
        "parent": "TaskPlann",
        "meta": {
            "sort": "2-1",
            "title": "计划任务管理",
            "roles": [
                3,
                4
            ],
            "icon": "el-icon-date"
        },
        "label": "计划任务管理"
    },
    {
        "path": "MyTask",
        "name": "MyTask",
        "parent": "TaskPlann",
        "meta": {
            "sort": "2-3",
            "title": "我的任务",
            "roles": [
                3,
                4,
                5
            ],
            "icon": "el-icon-s-claim"
        },
        "children": [
            {
                "path": "MyTaskList",
                "name": "MyTaskList",
                "parent": "MyTask",
                "meta": {
                    "sort": "2-3-1",
                    "title": "任务列表",
                    "roles": [
                        3,
                        4,
                        5
                    ],
                    "icon": ""
                },
                "label": "任务列表"
            },
            {
                "path": "MyData",
                "name": "MyData",
                "parent": "MyTask",
                "meta": {
                    "sort": "2-3-2",
                    "title": "我的数据",
                    "roles": [
                        3,
                        4,
                        5
                    ],
                    "icon": ""
                },
                "label": "我的数据"
            },
            {
                "path": "NotApproved",
                "name": "NotApproved",
                "parent": "MyTask",
                "meta": {
                    "sort": "2-3-3",
                    "title": "审核不通过待修改",
                    "roles": [
                        3,
                        4,
                        5
                    ],
                    "icon": ""
                },
                "label": "审核不通过待修改"
            }
        ],
        "label": "我的任务"
    },
    {
        "path": "AllData",
        "name": "AllData",
        "parent": "TaskPlann",
        "meta": {
            "sort": "2-4",
            "title": "数据审核",
            "roles": [
                3,
                4
            ],
            "icon": "el-icon-document"
        },
        "children": [
            {
                "path": "AllStatistics",
                "name": "AllStatistics",
                "parent": "AllData",
                "meta": {
                    "sort": "2-4-1",
                    "title": "所有数据",
                    "roles": [
                        3,
                        4
                    ],
                    "icon": "el-icon-document"
                },
                "label": "所有数据"
            },
            {
                "path": "AuditableData",
                "name": "AuditableData",
                "parent": "AllData",
                "meta": {
                    "sort": "2-4-2",
                    "title": "待审核数据",
                    "roles": [
                        3,
                        4
                    ],
                    "icon": ""
                },
                "label": "待审核数据"
            },
            {
                "path": "NoLongerAudit",
                "name": "NoLongerAudit",
                "parent": "AllData",
                "meta": {
                    "sort": "2-4-3",
                    "title": "不通过再审核",
                    "roles": [
                        3,
                        4
                    ],
                    "icon": ""
                },
                "label": "不通过再审核"
            }
        ],
        "label": "数据审核"
    },
    {
        "path": "Rule",
        "name": "Rule",
        "parent": "NamedManagement",
        "meta": {
            "sort": 7,
            "title": "命名管理",
            "roles": [
                3
            ],
            "icon": ""
        },
        "label": "命名管理"
    },
    {
        "path": "MyTaskList",
        "name": "MyTaskList",
        "parent": "MyTask",
        "meta": {
            "sort": "2-3-1",
            "title": "任务列表",
            "roles": [
                3,
                4,
                5
            ],
            "icon": ""
        },
        "label": "任务列表"
    },
    {
        "path": "MyData",
        "name": "MyData",
        "parent": "MyTask",
        "meta": {
            "sort": "2-3-2",
            "title": "我的数据",
            "roles": [
                3,
                4,
                5
            ],
            "icon": ""
        },
        "label": "我的数据"
    },
    {
        "path": "NotApproved",
        "name": "NotApproved",
        "parent": "MyTask",
        "meta": {
            "sort": "2-3-3",
            "title": "审核不通过待修改",
            "roles": [
                3,
                4,
                5
            ],
            "icon": ""
        },
        "label": "审核不通过待修改"
    },
    {
        "path": "AllStatistics",
        "name": "AllStatistics",
        "parent": "AllData",
        "meta": {
            "sort": "2-4-1",
            "title": "所有数据",
            "roles": [
                3,
                4
            ],
            "icon": "el-icon-document"
        },
        "label": "所有数据"
    },
    {
        "path": "AuditableData",
        "name": "AuditableData",
        "parent": "AllData",
        "meta": {
            "sort": "2-4-2",
            "title": "待审核数据",
            "roles": [
                3,
                4
            ],
            "icon": ""
        },
        "label": "待审核数据"
    },
    {
        "path": "NoLongerAudit",
        "name": "NoLongerAudit",
        "parent": "AllData",
        "meta": {
            "sort": "2-4-3",
            "title": "不通过再审核",
            "roles": [
                3,
                4
            ],
            "icon": ""
        },
        "label": "不通过再审核"
    }
]


function routerName(arr){
    let emptyArr = []
    arr.forEach((item)=>{
        if(item.children &&  item.children.length){
           let car =  routerName(item.children)
           emptyArr.push(...car)
        }
        emptyArr.push(item.name)
    })
    return emptyArr
}
let newName = routerName(arr)
console.log(newName);
console.log(newName.length);